<?php include_once("../../../common/common_setting_unit.php");         // 引入通用的设置文件 ?>
<?php include_once(ROOT_PATH_ . "/controller/common/module/head.php"); // 引入通用的头部 ?>
<?php include_once("../controller/data_edit.php");                     // 当前页面的控制器 ?>






<?
//==============================================================================
//这里开始才是平常开发需要注重的部分，其余的基本不用理会
//==============================================================================
?>

<div id="window">

    <!--标题设定-->
    <?php $page_title='订单信息';?>
    <?php include ROOT_PATH_ . '/controller/common/module/mod-page-title.php'; ?>




    <div class="info">
        <div class="sbox">
            <div class="relation">
                <text class="state"><? echo $order_info['order_sn']?></text>
                <text>客户订单号</text>
            </div>
        </div>


        <div class="sbox">
            <div class="relation">
                <text class="state"><? echo $order_info['transaction_id']?></text>
                <text>TRANSACTION_ID</text>
            </div>
        </div>

        <div class="sbox">
            <div class="relation">
                <text class="state"><? echo $order_info['order_id']?></text>
                <text>订单编号</text>
            </div>
        </div>



    </div>

    <ul class="detail-box layui-form" style="padding-bottom: 25px" >


            <input type="hidden"  name="order_id" value="<? echo $order_info['order_id']?>" >



    <!--标题设定-->
    <?php $page_title='订单资料';?>
    <?php include ROOT_PATH_ . '/controller/common/module/mod-page-title.php'; ?>


            <div class="layui-row">
                <div class="layui-col-md5" >
                <!--普通的input文本输入-->
            <li class="layui-form-item name">
                <label class="layui-form-label">产品：</label>
                <div class="layui-input-block">
                    <input type="text" class="layui-input" disabled  value="<? echo $order_info['order_name'] ?>">
                </div>
            </li>



            <!--普通的input文本输入-->
            <li class="layui-form-item name">
                <label class="layui-form-label">价格：</label>
                <div class="layui-input-block">
                    <input type="text" class="layui-input" disabled  value="<? echo $order_info['order_price'] ?>">
                </div>
            </li>


            <!--普通的input文本输入-->
            <li class="layui-form-item name">
                <label class="layui-form-label">学生：</label>
                <div class="layui-input-block">
                    <input type="text" class="layui-input" name="ai_student_name"   value="<? echo $order_info['student_name'] ?>">
                </div>
            </li>


                    <!--普通的input文本输入-->
                    <li class="layui-form-item name">
                        <label class="layui-form-label">班别：</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input" name="ai_student_info"  value="<?echo  $order_info['student_info']?>">
                        </div>
                    </li>




                    <li class="layui-form-item name">
                        <label class="layui-form-label">家长电话：</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input" disabled  value="<? echo $user['phone'] ?>">
                        </div>
                    </li>


                </div>


                <div class="layui-col-md5" >

                    <!--普通的textarea多行文本输入-->
                    <li class="layui-form-item introduce">
                        <label class="layui-form-label">申请日期：</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input laydate_time" value="<?echo $order_info['apply_date']?>"/>
                        </div>
                    </li>



            <!--单选项-->
            <li class="layui-form-item publish">
                <label class="layui-form-label">支付状态：</label>
                <div class="layui-input-block">
                    <input  type='radio'  checked title="<?echo $pay_status[$order_info['pay_status']]?>" />
                    <br class="clearfloat"/>
                    <em class="notice">当前支付状态 </em>

                </div>
            </li>


                    <!--普通的textarea多行文本输入-->
                    <li class="layui-form-item introduce">
                        <label class="layui-form-label">退款原因：</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea"  name="ai_refund_reason"><?echo  $order_info['refund_reason']?>   </textarea>
                        </div>
                    </li>



                </div>
            </div>





            <div style="margin: 40px 0">
                <!--标题设定-->
                <?php $page_title='退款申请记录';?>
                <?php include ROOT_PATH_ . '/controller/common/module/mod-page-title.php'; ?>




                <?if(count(array_filter($refund_info))){?>

                    <table  class="layui-table">
                        <thead>
                        <tr>
                            <th>退款金额</th>
<!--                            <th>用户申请时间</th>-->
<!--                            <th>退款时间</th>-->
                            <th>内部申请时间</th>
                            <th>申请人</th>
                            <th>退款理由</th>
                            <th>停止配送时间</th>
                            <th>审核状态</th>
                            <th>审核时间</th>
                        </tr>
                        </thead>
                        <tbody>

                        <?php
                        foreach ($refund_apply_list as $key2=> $value2) {
                            ?>
                            <tr>
                                <td><?echo $value2['price']?></td>
<!--                                <td> </td>-->
<!--                                <td> </td>-->
                                <td><?echo $value2['apply_date']?></td>
                                <td><?echo $value2['apply_employee']?></td>
                                <td><?echo $value2['remark']?></td>
                                <td><?echo $value2['stop_deliver_date']?></td>
                                <td><?echo $value2['apply_status']?></td>
                                <td><?echo $value2['aprove_date']?></td>
                            </tr>
                        <?}?>

                        </tbody>
                    </table>
                    <?;}else{?>
                    <div style="text-align: center">暂无记录</div>

                <?}?>



                <!--标题设定-->
                <?php $page_title='退款成功记录';?>
                <?php include ROOT_PATH_ . '/controller/common/module/mod-page-title.php'; ?>


                <?if(count(array_filter($refund_info))){?>

                    <table  class="layui-table">
                        <thead>
                        <tr>
                            <th>退款金额</th>
                            <th>退款时间</th>
                        </tr>
                        </thead>
                        <tbody>

                        <?php
                        foreach ($refund_info as $key => $value) {
                            ?>
                            <tr>
                                <td><?echo $value['price']/100?></td>
                                <td><?echo $value['add_date']?></td>
                            </tr>
                        <?}?>

                        </tbody>
                    </table>
                    <?;}else{?>
                    <div style="text-align: center">暂无退款记录</div>

                <?}?>
            </div>





            <!--标题设定-->
            <?php $page_title='退款申请';?>
            <?php include ROOT_PATH_ . '/controller/common/module/mod-page-title.php'; ?>


        <!--普通的textarea多行文本输入-->
        <li class="layui-form-item introduce">
            <label class="layui-form-label">申请编号：</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input"     disabled  value="<?echo $refund_apply_data['nid']?>"/>
            </div>
        </li>


        <!--普通的textarea多行文本输入-->
        <li class="layui-form-item introduce">
            <label class="layui-form-label">申请人：</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input"  id="price"   disabled  value="<?echo $refund_apply_data['apply_employee']?>"/>
            </div>
        </li>


            <!--普通的textarea多行文本输入-->
            <li class="layui-form-item introduce">
                <label class="layui-form-label">申请日期：</label>
                <div class="layui-input-block">
                    <input type="text" class="layui-input laydate_time" disabled value="<?echo $refund_apply_data['apply_date']?>"/>
                </div>
            </li>




        <li class="layui-form-item introduce">
            <label class="layui-form-label">停止配送：</label>
            <div class="layui-input-block">
                <?foreach ($order_detail as $key => $value){?>
                    <input type="checkbox" name="ai_stop_deliver_date[]" disabled
                           lay-skin="primary"
                           title="<?echo substr($value['ondate'],0,10)?> - <?echo $value['status']?>"
                        <?if(in_array($value['ondate'],$refund_apply_stop_deliver)){echo "checked";}?>
                           class="layui-input laydate_time" value="<?echo $value['ondate']?>"/>
                <?}?>
                <br class="clearfloat"/>
                <em class="notice" style="color: red">停止配送日期，将会在退款申请审核之后，生效。请注意审核<br/></em>
            </div>
        </li>



        <!--普通的textarea多行文本输入-->
            <li class="layui-form-item introduce">
                <label class="layui-form-label">退款金额：</label>
                <div class="layui-input-block">
                    <input type="text" class="layui-input"  id="price"   disabled  value="<?echo $refund_apply_data['price']?>"/>
                </div>
            </li>



            <!--普通的textarea多行文本输入-->
            <li class="layui-form-item introduce">
                <label class="layui-form-label">申请备注：</label>
                <div class="layui-input-block">
                    <textarea class="layui-textarea"  disabled  ><?echo  $refund_apply_data['remark']?></textarea>
                    <em class="notice">(填写本文的概述)</em>
                </div>
            </li>


            <!--标题设定-->
            <?php $page_title='申请审核';?>
            <?php include ROOT_PATH_ . '/controller/common/module/mod-page-title.php'; ?>

        <form id="data_form" method="post" class="layui-form"
              action ="data_apply_aprove_process.php?<? echo $url_parameter ?>"
              enctype="multipart/form-data">

            <input type="hidden"  name="nid" value="<? echo $_REQUEST['nid']?>" >


            <!--单选项-->
            <li class="layui-form-item publish">
                <label class="layui-form-label">审核状态：</label>
                <div class="layui-input-block">
                    <input  type='radio' name="ai_apply_status"   title="同意"  value="同意"   />
                    <input  type='radio' name="ai_apply_status"   title="驳回"  value="驳回"  checked />
                    <input  type='radio' name="ai_apply_status"   title="撤销"  value="撤销"   />
                </div>
                <span class="notice">*驳回不改变订单付款状态 ; 撤销会把状态从"退款中"变回"已付款" ; 状态为"已退款"的订单，只会撤销申请，不会改变订单状态。</span>

            </li>



            <!--普通的textarea多行文本输入-->
            <li class="layui-form-item introduce">
                <label class="layui-form-label">审核备注：</label>
                <div class="layui-input-block">
                    <textarea class="layui-textarea" name="ai_aprove_reason"  ><?echo  $refund_apply_data['aprove_reason']?></textarea>
                </div>
            </li>



<?if($refund_apply_data['apply_status'] != '同意'){?>

            <div class="function">

                <button class="layui-btn"  lay-submit type="submit" >立即提交</button>

                <input type="reset" class="layui-btn" value="重置"/>

            </div>
<?;}?>


        </form>
    </ul>

</div>



<?
//==============================================================================
//这里上面才是平常开发需要注重的部分，下面的基本不用理会，只有底部JS部分需要根据实际情况去加载
//==============================================================================
?>



</div>
<!--detail-box end-->


</div>
<!--content端點01-->



</div>
<!--maincontent-->
<br class="clearfloat"/>
</div>
<!--container-->
</div>





<!--渲染日期需要用到的-->
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#publish_date' //指定元素
            ,type: 'datetime'
        });
    });
</script>








<?php include ROOT_PATH_ . "/controller/common/module/footer.php"; ?>
